﻿using System.Collections.Generic;
using System.Web.Mvc;
using FluentValidation;
using FluentValidation.Attributes;
using Nop.Services.Localization;
using Nop.Web.Framework;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc;
using System.ComponentModel.DataAnnotations;
using Nop.Web.Framework.Validators;
using Nop.Web.Models.Catalog;

namespace Nop.Plugin.Widgets.Ribbon.Models
{
    [Validator(typeof(RibbonValidator))]
    public partial class RibbonModel : BaseNopEntityModel
    {
        public RibbonModel()
        {

        }
        [NopResourceDisplayName("Plugins.Widgets.Ribbon.Fields.Name")]
        public string Name { get; set; }

        [NopResourceDisplayName("Plugins.Widgets.Ribbon.Fields.Text")]
        public string Text { get; set; }

        [NopResourceDisplayName("Plugins.Widgets.Ribbon.Fields.Published")]
        public bool Published { get; set; }

        [NopResourceDisplayName("Plugins.Widgets.Ribbon.Fields.RibbonClass")]
        public string RibbonClass { get; set; }

        [NopResourceDisplayName("Plugins.Widgets.Ribbon.Fields.RibbonColor")]
        public string RibbonColor { get; set; }

        [NopResourceDisplayName("Plugins.Widgets.Ribbon.Fields.TargetClass")]
        public string TargetClass { get; set; }
        
    }


    public class RibbonValidator : BaseNopValidator<RibbonModel>
    {
        public RibbonValidator(ILocalizationService localizationService)
        {
            RuleFor(x => x.Name).NotNull().WithMessage(localizationService.GetResource("Plugins.Widgets.Ribbon.Fields.Name.Required"));
            RuleFor(x => x.Text).NotNull().WithMessage(localizationService.GetResource("Plugins.Widgets.Ribbon.Fields.Text.Required"));
            RuleFor(x => x.RibbonClass).NotNull().WithMessage(localizationService.GetResource("Plugins.Widgets.Ribbon.Fields.RibbonClass.Required"));
            RuleFor(x => x.TargetClass).NotNull().WithMessage(localizationService.GetResource("Plugins.Widgets.Ribbon.Fields.TargetClass.Required"));
        }
    }
}